package com.bw.hadoop;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;
import org.apache.hadoop.ipc.Server;

/**
 * 服务端
 */
public class NameNodeRpcServer implements ClientProtocol {
    @Override
    public void putData(String data) {
        System.out.println("服务端执行："+data);
    }

    public static void main(String[] args) throws Exception {
        Server server = new RPC.Builder(new Configuration()).setBindAddress("localhost")
                .setPort(9999)
                .setProtocol(ClientProtocol.class)
                .setInstance(new NameNodeRpcServer())
                .build();

        //启动服务端
        server.start();
    }
}